package com.kyk.controller;

import com.kyk.service.IUploadService;
import com.kyk.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


@RestController
@RequestMapping("/upload")
public class UploadController {


    @Autowired
    IUploadService uploadService;

     /**
      * 上传文件
      * @param file
      * @return
      */
    @PostMapping
    public Result upload(@RequestParam("file")MultipartFile file) {
        return uploadService.upload(file);

    }
     /**
      * 删除文件
      * @param webPath
      * @return
      */
     @DeleteMapping
    public Result deleteFile(@RequestParam("webPath") String webPath) {
        return uploadService.deleteFile(webPath);
    }

}
